package com.automannn.practice.mybatis.springBootMybaitsPlus;

import com.automannn.practice.mybatis.dao.PersonDao;
import com.automannn.practice.mybatis.dao.PersonPlusTestDao;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.mybatis.spring.annotation.MapperScan;
import org.mybatis.spring.boot.autoconfigure.MybatisAutoConfiguration;
import org.mybatis.spring.boot.autoconfigure.MybatisLanguageDriverAutoConfiguration;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;

/**
 * @author automannn
 * @Date 2022/8/23
 */
//xxx: 由于当前环境，存在mybatis-springBoot依赖，个别bean存在不兼容情况，暂时排除
@SpringBootApplication(exclude = {MybatisAutoConfiguration.class, MybatisLanguageDriverAutoConfiguration.class})
@MapperScan("com.automannn.practice.mybatis.dao")
public class SpringBootMybatisPlusTest {

    public static void main(String[] args) {
        ConfigurableApplicationContext applicationContext= SpringApplication.run(SpringBootMybatisPlusTest.class);

        PersonDao personDao= applicationContext.getBean(PersonDao.class);
        personDao.selectList();

        PersonPlusTestDao personPlusTestDao = applicationContext.getBean(PersonPlusTestDao.class);
        personPlusTestDao.selectList(Wrappers.emptyWrapper());

        personPlusTestDao.selectPage(new Page<>(),Wrappers.emptyWrapper());
    }
}
